package vsqlbuilder.logic;

public class Column {

	private String name;
	private boolean isKey;
	private String datatype; // TODO [very low]: create a class hierarchy for
								// datatype (Not Really important)
	private boolean notNull;
	private Table ownerTable;
	private boolean querySelected; // TODO [very low]: Study if this position
									// into the code (class hierarchy) of the
									// variable is best or not [Control of the
									// column should be draw in a table graph as
									// selected for the query or not.]

	public Column(Table owner, String columnName) {
		this.name = columnName;
		this.ownerTable = owner;
		this.isKey = false;
		this.notNull = false;
		this.datatype = "not_defined_yet";
		this.querySelected = false;
	}

	public String getName() {
		return this.name;
	}

	public void setDataType(String dataType) {
		datatype = dataType;
	}

	public void setIsNotNull(boolean value) {
		this.notNull = value;
	}

	public void setIsKey(boolean value) {
		this.isKey = value;
	}

	public String getDataType() {
		return this.datatype;
	}

	public void setQuerySelected(boolean Selected) {
		this.querySelected = Selected;
	}

	// toString method returns the string to be displayed for a table node in a
	// JTree
	public String toString() {
		return this.name;
	}

	public boolean getQuerySelected() {
		return this.querySelected;
	}

	public boolean isKeyColumn() {
		return this.isKey;
	}

	public boolean isNotNull() {
		return this.notNull;
	}

	public Table getParentTable() {
		return this.ownerTable;
	}

}
